package common.entity;

import com.alibaba.fastjson.JSON;
import common.util.GlobalFastJsonConfig;
import lombok.Data;

import java.util.Collection;

/**
 * 返回列表数据
 *
 * @author yuanqinglong
 * @since 2021/7/19 14:29
 */
@Data
public class TableData {


    /**
     * 数据
     */
    private String list;

    /**
     * 总数
     */
    private Object count;


    public TableData(Collection<?>  data) {
        this.list = JSON.toJSONString(data, GlobalFastJsonConfig.getSnakeCase());
    }

    public TableData(Collection<?>  data, Object total) {
        this.list = JSON.toJSONString(data, GlobalFastJsonConfig.getSnakeCase());
        this.count = total;
    }
}
